package com.csk.zsk.compents.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.csk.zsk.compents.dao.RatingDao;
import com.csk.zsk.compents.entity.Rating;
import com.csk.zsk.compents.service.RatingService;

@Service
@Transactional
public class RatingServiceImpl implements RatingService {

	@Autowired
	private RatingDao ratingDao;

	@Override
	public void saveRating(Rating rating) {
		ratingDao.save(rating);

	}

	@Override
	public void deleteRating(String id) {
		ratingDao.delete(id);

	}

	@Override
	@Transactional(readOnly = true)
	public List<Rating> findRatingBy(String propertyName, Object value) {
		return ratingDao.findBy(propertyName, value);
	}

	@Override
	@Transactional(readOnly = true)
	public Rating getRatingById(String id) {
		return ratingDao.get(id);
	}

	@Override
	@Transactional(readOnly = true)
	public Rating findUniqueBy(String propertyName, Object value) {
		return ratingDao.findUniqueBy(propertyName, value);
	}

	@Override
	@Transactional(readOnly = true)
	public String getRatingAVG(String objid) {
		return ratingDao.getRatingAVG(objid);
	}

	@Override
	@Transactional(readOnly = true)
	public Rating getUserRating(String userid, String objid) {
		return ratingDao.getUserRating(userid, objid);
	}

}
